<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./index.css">
    <title>首页</title>
</head>

<body>
    <div class="header">
        <div id="search">
            <input type="text" placeholder="搜索职位">
            <button type="button">搜 索</button>
        </div>
    </div>
    <div class="meun"></div>

    <div class="content">
        <div class="con">
        </div>

        <div class="right">
            <img src="https://fecdn4.zhaopin.cn/sou/assets/resume-template.e4b9643e2e602b6788249fc81ad5339a.jpg" alt="">
            <img src="https://fecdn4.zhaopin.cn/sou/assets/1-resume.a3759d3930eaca7731429b23c9302823.png" alt="">
        </div>
    </div>

    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
    </script>
    <script src="./js/template.js"></script>
    <script>
        $(document).ready(function(){
            getDataList()
           
        })

        $('#search button').click(function(){
            var val=$('#search input').val()
            getDataList(val)
        })

        $('.con').on('click','.list',function(){
           var id =  $(this).attr('data-id')
           sessionStorage.setItem('id',id)
           window.open('./demo.html?id='+id)
        })


        function getDataList(data){//data传参数
            $.get(BASEURL+'/recruit',{
                data:data,//寻找接口的data下的"data值
                positionName:data
            },function(data){
                var dataList = data.data.list; 
                res(dataList)
            })
        }



        function res (dataList){
            $(".con").empty()
           for(let index in dataList){
               var temp = dataList[index].welfareName;
               temp = temp.split(',');
               var welfareNameHTML=''
               for(let i in temp){
                welfareNameHTML=welfareNameHTML+'<span>'+temp[i]+'</span>'
               }
               var html=
               '   <div class="list" data-id="'+dataList[index].id+'">'
           +'    <div class="list-left">'
           +'        <div class="title">'
           +'            <span>'+dataList[index].positionName+'</span>'
           +'            <div class="contact">'
           +'                <img src="./2.png" alt="">'
           +'            </div>'
           +'        </div>'
           +'        <div class="dis">'
           +'            <span class="salary">'+dataList[index].salaryName+'</span>'
           +'            <span class="place">'+dataList[index].cityName+'</span>'
           +'            <span class="working-years"><span>'+dataList[index].experienceName+'</span>年</span>'
           +'            <span class="education">'+dataList[index].educationName+'</span>'
           +'        </div>'
           +'        <div class="welfare">'+welfareNameHTML+'</div>'
           +'        <div class="apply">'
           +'            <div class="collections"></div>'
           +'            <button type="button" class="a-button">申请职位</button>'
           +'        </div>'
           +'    </div>'
           +'    <div class="list-right">'
           +'        <div class="name">'+dataList[index].companyName+'</div>'
           +'        <div class="type">'
           +'            <span class="working-years">民营</span>'
           +'            <span class="education"><span>20-99</span>人</span>'
           +'        </div>'
           +'    </div>'
           +'</div>'
           $('.con').append(html)
           }
        }
    </script>
</body>

</html>